home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
hardware
/
ryemouse
/
test.c
< prev
Wrap
C/C++ Source or Header
|
1995-01-22
|
4KB
|
224 lines
#include"ryemouse.h"
#include<stdlib.h>
int x,y,button;
/////////////////////////////////////////////////////////////////////
char getkey(void){
char c=0;
if(kbhit())c=getch();
return c;
}
/////////////////////////////////////////////////////////////////////
void demo1(void){
asm{
mov ax,0x0012
int 0x10
}
gotoxy(1,1);
printf("Press any key to exit.");
do{
showmouse();
delay(200);
hidemouse();
delay(200);
}while(!getkey());
}
/////////////////////////////////////////////////////////////////////
void demo2(void){
asm{
mov ax,0x0003
int 0x10
}
gotoxy(1,1);
printf("The following is an example of graphics cursors. It will stop\nautomatically.\n");
delay(5000);
asm{
mov ax,0x0003
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x0004
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x0005
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x0006
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x000D
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x000E
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x000F
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x0010
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x0011
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x0012
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x0013
int 0x10
}
showmouse();
delay(1000);
asm{
mov ax,0x0003
int 0x10
}
}
/////////////////////////////////////////////////////////////////////
void demo3(void){
asm{
mov ax,0x0012
int 0x10
}
gotoxy(1,1);
printf("Bounding box from 220,140 - 420,340.\n");
printf("Press any key...");
setxlimit(220,420);
setylimit(140,340);
showmouse();
while(!getkey());
}
/////////////////////////////////////////////////////////////////////
void demo4(void){
asm{
mov ax,0x0012
int 0x10
}
showmouse();
gotoxy(1,20);
printf("Press any key...");
do{
getmouse(&x,&y,&button);
gotoxy(1,1);
printf("X:%3d Y:%3d Buttons:%1d",x,y,button);
}while(!getkey());
}
/////////////////////////////////////////////////////////////////////
void demo5(void){
asm{
mov ax,0x0012
int 0x10
}
showmouse();
gotoxy(1,1);
printf("Press any key...");
do{
setmousepos(random(639),random(479));
delay(100);
}while(!getkey());
}
/////////////////////////////////////////////////////////////////////
void demo6(void){
asm{
mov ax,0x0012
int 0x10
}
showmouse();
gotoxy(1,1);
printf("This is an example of mouse motion scanning\nPress any key...");
do{
delay(100);
getmotion(&x,&y);
gotoxy(1,20);
printf("X motion:%5d Y motion:%5d",x,y);
}while(!getkey());
}
/////////////////////////////////////////////////////////////////////
void main(void){
char key=0;
int x,y,button;
initmouse();
asm{
mov ax,0x0003
int 0x10
}
do{
asm{
mov ax,0x0003
int 0x10
}
gotoxy(1,1);
printf("Ryemouse.lib demo program\n\nHit letter to see demo.\n\n");
printf("a) Show/hide mouse demo.\n");
printf("b) Graphics mode cursors.\n");
printf("c) Bounding box demo.\n");
printf("d) Getmouse demo.\n");
printf("e) Setmousepos demo.\n");
printf("f) Getmotion demo.\n");
printf("g) Grand tour of all demos.\n");
printf("\nESC to exit\n");
do{
key=getkey();
}while(!key);
if(key==97)demo1();
if(key==98)demo2();
if(key==99)demo3();
if(key==100)demo4();
if(key==101)demo5();
if(key==102)demo6();
if(key==103){
demo1();
demo2();
demo3();
demo4();
demo5();
demo6();
}
}while(key!=27);
asm{
mov ax,0x0003
int 0x10
}
}
/////////////////////////////////////////////////////////////////////